import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'
import * as path from 'path'

export default defineConfig({
  plugins: [
    vue(),
    WindiCSS(),
  ],
  //配置跨域
  server: {
    open: true,  //启动项目后打开浏览器
    port: 81,
    proxy: {
      '/api': {
        target: 'http://localhost:9001',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
  // @别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  }
})
